<template>
    <h2>显示投资项目</h2>
    投资项目名称：<input type="text" v-model="Iname" />
    <button @click="SelInvest()">查询</button>
    <table>
    <thead>
        <tr>
            <th>投资编号</th>
            <th>投资项目名称</th>
            <th>投资总额度</th>
            <th>已投资金额</th>
            <th>剩余金额</th>
            <th>投资人数</th>
        </tr>
    </thead>
    <tbody>
        <tr v-for="item in info">
            <th>{{item.Iid}}</th>
            <th>{{item.Iname}}</th>
            <th>{{item.IbigPrice}}</th>
            <th>{{item.IgivePrice}}</th>
            <th>{{item.IlastPrice}}</th>
            <th>{{item.Inumber}}</th>
        </tr>
    </tbody>
    </table>
</template>
<script setup lang="ts">
import { onMounted,ref } from 'vue';
import { useRouter } from 'vue-router';
import axios from 'axios';


const router = useRouter();
onMounted(() => {
    SelInvest();
})

const info = ref([{
    Iid: "",
    Iname: "",
    IbigPrice: "",
    IgivePrice: "",
    IlastPrice: "",
    Inumber: "",
}]);

const Iname=ref("");
const SelInvest = () => {
    axios.get('http://localhost:53393/api/invest/ShowInvest',
        {
            params: {
                name: Iname.value,
            }
        }
    )
    .then((res) => {
        console.log(res.data);
        info.value = res.data;
    })
    .catch((err) => {
        console.log(err);
    });
}




</script>
